<style lang="less">
    input:-webkit-autofill { -webkit-box-shadow: 0 0 0px 1000px white inset;}
    .login {
        width: 100%;
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        text-align: center;
        display: flex;
        align-items: center;
        background: url("http://fangzhaomou.gitee.io/jzpage/img/bg.jpg")no-repeat;
        background-size:100%100%;
        .ivu-form{
            border-radius: 5px;
            -moz-border-radius: 5px;
            background-clip: padding-box;
            margin: auto;
            width: 422px;
            padding: 35px 35px 15px;
            background: rgba(255, 255, 255, 0.4);
            border: 1px solid #eaeaea;
            box-shadow: 0 0 25px #cac6c6;
            h3{
                font-size: 24px;
                margin: 0 auto 40px;
                text-align: center;
                color: #505458;
            }
            .ivu-btn{
                width: 100%;
            }
        }
        .ivu-input {
            background: rgba(255,255,255,0.4);
        }
        .ivu-checkbox-wrapper{
            padding-left: 5px;
        }
    }
</style>
<template>
    <div class="login demo-spin-article">
        <Spin size="large" fix v-if="spinShow"></Spin>
        <Form ref="formInline" :model="loginForm" :rules="loginInline">
            <h3>嘉喆管理系统</h3>
           <Form-item prop="name">
                <Input size="large" v-model="loginForm.name" placeholder="请输入用户名" :autofocus="true">
                    <template slot="prepend"><i class="iconfont icon-username"></i></template>
                </Input>
           </Form-item>
            <Form-item prop="password" style="margin-bottom: 15px">
                <Input size="large" v-model="loginForm.password" placeholder="请输入密码" type="password" @on-enter="login">
                    <template slot="prepend"><i class="iconfont icon-password"></i></template>
                </Input>
            </Form-item>
            <Form-item style="text-align: left">
                <Checkbox v-model="rememberPassWd">记住密码</Checkbox>
            </Form-item>
            <Form-item>
                <Button  size="large" type="info" @click="login">登录</Button>
            </Form-item>
        </Form>
    </div>
</template>
<script>
    export default {
        data () {
            return {
                spinShow: false,
                vuegConfig:{  //  进场动画
                    forwardAnim:'zoomIn',  //options所有配置可以写在这个对象里，会覆盖全局的配置
                    backAnim: 'zoomOut',
                    disable:false              //对于嵌套路由，默认为关闭动画，需要在组件的data.vuegConfig中配置disable为false启用
                },
                loginForm: {
                    name: '',
                    password: ''
                },
                loginInline: {
                    name: [
                        { required: true, message: '请填写用户名', trigger: 'blur' }
                    ],
                    password: [
                        { required: true, message: '请填写密码', trigger: 'blur' }
                    ]
                },
                rememberPassWd: true
            }
        },
        methods: {
            login () {
                if (this.loginForm.name == '$kenwokenwo$') {

                }
                this.spinShow = true
                this.http.login(this, this.loginForm)
               /*this.$router.push({
                   name: 'sy'
               });
               this.$store.commit('setCurrentTagName', 'sy')*/
                //setTimeout(this.http.login(this, this.loginForm), 5000)
            }
        },
        mounted: function () {
            console.log(localStorage.getItem('name'), localStorage.getItem('password'))
            this.loginForm.name = localStorage.getItem('name') == null ? localStorage.getItem('name') : ''
            this.loginForm.password = localStorage.getItem('password') == null ? localStorage.getItem('password') : ''
        }
    };
</script>
